Skip to content

fix(openai-compat): inherit static thinking support#3849

Closed
iiiiiie wants to merge 7 commits into
router-for-me:devfrom
iiiiiie:fix/openai-compat-static-thinking
Closed

fix(openai-compat): inherit static thinking support#3849
iiiiiie wants to merge 7 commits into
router-for-me:devfrom
iiiiiie:fix/openai-compat-static-thinking

Conversation

@iiiiiie

@iiiiiie iiiiiie commented Jun 14, 2026

Copy link
Copy Markdown

Summary

Fix OpenAI-compatible configured models so they inherit thinking/reasoning support from the static model registry when available.

Previously, OpenAI-compatible models without explicit thinking config always defaulted to:

levels: [low, medium, high]

That caused models such as gpt-5.5, which already support xhigh in the static registry, to reject valid Codex/Responses requests using reasoning.effort = xhigh before forwarding to the upstream provider.

Changes

  • Keep explicit per-model thinking config as the highest priority.
  • Keep image models without thinking support.
  • For OpenAI-compatible non-image models without explicit thinking, look up the static model definition by upstream model name.
  • If the static model has thinking support, inherit it.
  • Fall back to the existing low/medium/high default for unknown models.

Why

This preserves the current conservative fallback for unknown OpenAI-compatible models, while allowing known models like gpt-5.5 to use their declared static capabilities such as xhigh.

Tests

go test -mod=readonly ./sdk/cliproxy
go test -mod=readonly ./internal/thinking ./sdk/api/handlers/openai

@github-actions github-actions Bot changed the base branch from main to dev June 14, 2026 17:18
@github-actions

Copy link
Copy Markdown

This pull request targeted main.

The base branch has been automatically changed to dev.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors the thinking configuration logic in buildOpenAICompatibilityConfigModels into a new helper function openAICompatibilityModelThinking, allowing models to inherit thinking support from static registry definitions when available. Unit tests have been added to verify this inheritance, default fallback behavior, and explicit configuration preservation. The review feedback points out a potential issue where returning a direct pointer to the static registry's ThinkingSupport could expose global shared state to accidental mutation, and suggests performing a deep copy of the struct and its slice to prevent this.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread sdk/cliproxy/service.go Outdated
@iiiiiie iiiiiie changed the base branch from dev to main June 14, 2026 17:19
@github-actions github-actions Bot changed the base branch from main to dev June 14, 2026 17:19
@github-actions

Copy link
Copy Markdown

This pull request targeted main.

The base branch has been automatically changed to dev.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1f9241f9a2

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread sdk/cliproxy/service.go Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9eb8647b58

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread sdk/cliproxy/service.go Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1c1a30bd32

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread sdk/cliproxy/service.go Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 07236d6ea0

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread sdk/cliproxy/service.go

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b6a346e677

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread sdk/cliproxy/service.go

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 40dfebeb4c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/runtime/executor/openai_compat_executor.go Outdated
Comment thread sdk/cliproxy/service.go

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5727d89724

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread sdk/cliproxy/service.go
}
for modelID, levels := range pooled {
if len(levels) == 0 {
pooled[modelID] = defaultOpenAICompatibilityThinkingLevels()

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Do not widen empty pooled thinking intersections

When duplicate OpenAI-compatible aliases have explicit non-overlapping thinking.levels, this fallback replaces the empty intersection with the default low, medium, high set. For a pool like shared -> m1 with only xhigh and shared -> m2 with only low, requests such as shared(medium) now pass validation even though no upstream in the pool advertises that level, so the executor can forward an unsupported reasoning_effort depending on which pool member is selected. Keep the intersection empty (or disable thinking for the pool) instead of widening it to defaults.

Useful? React with 👍 / 👎.

@luispater luispater closed this Jun 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants